package com.hdu.point_offer;

import java.util.HashSet;
import java.util.Set;

public class lcr167 {
        class Solution {
            public int dismantlingAction(String arr) {
                Set<Character> set = new HashSet<>();
                int ans = 0;
                int l = 0, r = 0;
                while (r < arr.length())
                {
                    char c = arr.charAt(r);
                    while (set.contains(c)) set.remove(arr.charAt(l++));
                    set.add(c);
                    ans = Math.max(ans, r - l + 1);
                    r++;
                }
                return ans;
            }
        }
}
